package com.lagou.task17;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class DataInputStreamTest {
    public static void main(String[] args) {
        //创建一个DataInputStream对象关联文件
        DataInputStream dis = null;
        try {
            dis = new DataInputStream(new FileInputStream("a.txt"));
            //        读区数据
            int res = 0;
            while (-1 != (res = dis.read())){
                System.out.println("数据：" +  res);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (dis != null) {
                try {
                    dis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }



    }
}
